package net.huashitong.synthetical.student.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.synthetical.student.dao.DemoStudentDao;
import net.huashitong.synthetical.student.entity.DemoStudent;
import net.huashitong.synthetical.student.filter.DemoStudentFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName DemoStudentService
 * @Description 学生信息Service
 * @Author LK
 * @Date 2019/6/4 15:45
 * @Version V1.0
 **/
@Service
public class DemoStudentService extends StringPKService<DemoStudent> {

    @Autowired
    private DemoStudentDao demoStudentDao;

    @Autowired
    private SysTableService tableService;

    @Override
    protected void beforeSave(DemoStudent obj) {
        obj.setSysId(tableService.updateMaxSysId("t_demo_student", null));
    }

    @Override
    protected BaseDao<DemoStudent, String> getDao() {
        return demoStudentDao;
    }

    /**
     * 默认的查询方法
     * @author: huiyang.yu
     * @param filter
     * @return
     */
    public List<DemoStudent> query(DemoStudentFilter filter) {
        return demoStudentDao.queryByCondition(filter);
    }

}
